using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class COM_SERVICIOS_COM_CLASE : PaginaBaseKCG 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string ClaseId = Request.QueryString.Get("Com_Clase_Id");
            if (ClaseId != null)
            {
                fvservicios_com_clase.DefaultMode = FormViewMode.ReadOnly;
                AsignarParametrosDataSourceDeatailsView(ClaseId);
            }
        }
        base.Page_Load(sender, e);
        cargarBotones();
        fvservicios_com_clase.DataBound += new EventHandler(fvservicios_com_clase_DataBound);
    }

    void fvservicios_com_clase_DataBound(object sender, EventArgs e)
    {
        DeshabilitraBotonesEnInsert();
        if (Fv.CurrentMode == FormViewMode.Insert)
        {
            TextBox _valorTipo = (TextBox)Fv.FindControl("Tipo");
            _valorTipo.Text = "SER";
        }
    }

    private void DeshabilitraBotonesEnInsert()
    {
        if (Fv.CurrentMode == FormViewMode.Insert)
        {
            BtnAtributo.Enabled = false;
        }
        if (Fv.CurrentMode == FormViewMode.Edit || Fv.CurrentMode == FormViewMode.ReadOnly)
        {
            BtnAtributo.Enabled = true;
        }
    }

    private void cargarBotones()
    {
        BtnAtributo.Text = GetLocalResourceObject("Btn_Servicios_Com_Clase_Atributo RecursoKCG.Text").ToString();
        BtnAtributo.ToolTip = GetLocalResourceObject("Btn_Servicios_Com_Clase_Atributo RecursoKCG.ToolTip").ToString();
    }
    
    protected void BtnAtributo_Click(object sender, EventArgs e)
    {
        TextBox ClaseId = (TextBox)Fv.FindControl("Id");
        TextBox ClaseCodigo = (TextBox)Fv.FindControl("Codigo");
        TextBox ClaseNombre = (TextBox)Fv.FindControl("Nombre");
        Response.Redirect("~/COM/SERVICIOS_COM_CLASE_ATRIBUTO.aspx?Com_Clase_Id=" + ClaseId.Text + "&Com_Clase_Codigo=" + ClaseCodigo.Text + "&Com_clase_Nombre=" + ClaseNombre.Text);
    }

    protected override CheckBox CbInsertarMemoria
    {
        get { return null; }
    }

    protected override Type TipoObjeto
    {
        get { return typeof(global::Com_Clase); }
    }

    protected override GridView Gv
    {
        get { return gvservicios_com_clase; }
    }

    protected override FormView Fv
    {
        get { return fvservicios_com_clase; }
    }

    protected override ObjectDataSource OdsGv
    {
        get { return odsgvservicios_com_clase; }
    }

    protected override ObjectDataSource OdsDv
    {
        get { return odsfvservicios_com_clase; }
    }

    protected override Button BResponderZoom
    {
        get { return Seleccionar; }
    }

    protected override Button BRegreso
    {
        get { return Atras; }
    }

    protected override Koala.KoalaWebControls.KFiltro KftFiltro
    {
        get { return kftFiltro; }
    }
    protected override string Contenedor
    {
        get { return "SERVICIOS_COM_CLASE"; }
    }

    protected void nav_Siguiente(object sender, EventArgs e)
    {
        Gv_SelectedIndexChanged(sender, e);
    }
}
